package com.zzptc.liantian_android_1.adapter;

import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.zzptc.liantian_android_1.R;
import com.zzptc.liantian_android_1.vo.AddXianshi;
import java.util.List;


public class Jiemian_adapter extends RecyclerView.Adapter<Jiemian_adapter.ViewHolder>{

    private List<AddXianshi> list;
    public Jiemian_adapter(List<AddXianshi> list) {
        this.list = list;
    }

    @Override
    public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.add_item , parent , false);
        Jiemian_adapter.ViewHolder viewHolder = new Jiemian_adapter.ViewHolder(itemView);
        return viewHolder;
    }

    @Override
    public void onBindViewHolder(ViewHolder holder, int position) {

        AddXianshi itemData = list.get(position);
        holder.tvxiaoxi.setText(itemData.getXianshi());
        holder.tvtvxianshi.setText(itemData.getTvxiaoshi());
           }

    @Override
    public int getItemCount() {
        return list.size();
    }


    public static class ViewHolder extends RecyclerView.ViewHolder{
//        @BindView(R.id.tv_xianshi_item)
        TextView tvxiaoxi;
        TextView tvtvxianshi;
        public ViewHolder(View itemView) {
            super(itemView);
            tvxiaoxi = (TextView) itemView.findViewById(R.id.tv_xianshi_item);
            tvtvxianshi = (TextView) itemView.findViewById(R.id.tv_tvxianshi_item);
        }
    }
}
